import "../utils" as Utils
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.0
import QtGraphicalEffects 1.12
import Qt.labs.settings 1.0
Rectangle{
    color: "transparent"
    Utils.CheckScenesWarnPage{
        visible: swipeView.currentIndex===1
        anchors.fill: parent
        img_show: true
    } 
    

    Rectangle{
        width: parent.width
        height: 136
        color: "#0D0F12"
        visible: swipeView.currentIndex===3 || swipeView.currentIndex===2
        Utils.MyWarnBox{
            x:29
            y:18
            visible:swipeView.currentIndex===3
        }
        Rectangle{
            height: 82
            width: 367
            anchors.centerIn: parent
            color: "red"
            visible: swipeView.currentIndex===2
            Text{
                id:check_img_txt
                anchors.centerIn: parent
                color: "#FFFFFF"
                text:
                switch(image_manager.view_state)
                {
                    case 1:"前视野安全检查";break;
                    case 2:"后视野安全检查";break;
                    case 3:"左视野安全检查";break;
                    case 4:"右视野安全检查";break;
                }
                font{
                    family: "Aldrich"
                    pixelSize: 40
                }
                // Connections{
                //     target: image_manager
                //     onView_stateChanged: {
                //         switch(image_manager.view_state)
                //         {
                //             case 0:check_img_txt.text="前视野安全检查";break;
                //             case 1:check_img_txt.text="前视野安全检查";break;
                //             case 2:check_img_txt.text="前视野安全检查";break;
                //             case 3:check_img_txt.text="前视野安全检查";break;
                //         }
                //     }
                // }
            }
            
        }
        Image{
            visible: swipeView.currentIndex=== 3
            x:901
            y:31
            width: 64
            height: 64
            source: "qrc:/imgs/warn_4.png"
        }
        Image{
            visible: swipeView.currentIndex=== 3
            x:813
            y:31
            width: 64
            height: 64
            source: "qrc:/imgs/close_7.png"
        }
        Image{
            visible: swipeView.currentIndex=== 3
            x:989
            y:31
            width: 64
            height: 64
            source: "qrc:/imgs/info_3.png"
        }
    }
    Rectangle{
        width: parent.width
        height: 200
        anchors.bottom: parent.bottom
        color: "#0D0F12"
        visible: swipeView.currentIndex === 2
    }
    Rectangle{
        id:mid_bottom_info
        width: parent.width
        height: 200
        anchors.bottom: parent.bottom
        color: "#0D0F12"
        visible: swipeView.currentIndex === 3

        Rectangle{
            color: "#00000000"
            x:24
            y: 64
            width: 328
            height: 72
            // color: "#000000"
            Image{
                width: 172
                height: 72
                anchors.left:parent.left
                source: "qrc:/scraper/imgs/bottom_icon4.png"
            }
            Text{
                color: "#FCFCFC"  
                anchors.right: parent.right
                anchors.bottom: parent.bottom
                text: can_manager.vehicle_angle_x.toFixed(1) > 60 ? "60" : can_manager.vehicle_angle_x.toFixed(1) < -60  ? "-60" : can_manager.vehicle_angle_x.toFixed(1)
                font{
                    family: "Aldrich"
                    pixelSize: 64
                }
            }
        }
        Rectangle{
            height: 120
            width: 2
            x: 412
            y: 40
            color: "transparent"
            LinearGradient{     
                anchors.fill: parent
                start:Qt.point(0,0)
                end:Qt.point(0,parent.height)
                gradient: Gradient{
                    GradientStop{position:0.0;color:"transparent"}
                    GradientStop{position:0.5;color:"#00FFFF"}
                    GradientStop{position:1.0;color:"transparent"}
                }
            }
        }
        Rectangle{
            x: 474
            y:50
            width: 129
            height: 100
            color: "transparent"
            Text{
                anchors.top: parent.top
                anchors.horizontalCenter: parent.horizontalCenter
                color: "#00FFF0"
                text: switch(can_manager.gear)
                    {
                        case 0:"N";break;
                        case 1:"F1";break;
                        case 2:"F2";break;
                        case 3:"F3";break;
                        case 4:"R1";break;
                        case 5:"R2";break;
                        case 6:"R3";break;
                    }
                font{
                    family: "Aldrich"
                    pixelSize: 96
                }
            }
            // Rectangle{
            //     color: "#00FFF0"
            //     height:12 
            //     width: parent.width
            //     anchors.bottom: parent.bottom
            //     radius: 6
            // }
        }
        Rectangle{
            height: 120
            width: 2
            x: 654
            y: 40
            color: "transparent"
            LinearGradient{     
                anchors.fill: parent
                start:Qt.point(0,0)
                end:Qt.point(0,parent.height)
                gradient: Gradient{
                    GradientStop{position:0.0;color:"transparent"}
                    GradientStop{position:0.5;color:"#00FFFF"}
                    GradientStop{position:1.0;color:"transparent"}
                }
            }
        }
        Rectangle{
            color: "#00000000"
            x:716
            y: 64
            width: 328
            height: 72
            // color: "#000000"
            Image{
                width: 172
                height: 72
                anchors.left:parent.left
                source: "qrc:/scraper/imgs/bottom_icon6.png"
            }
            Text{
                color: "#FCFCFC"  
                anchors.right: parent.right
                anchors.bottom: parent.bottom
                text: can_manager.vehicle_angle_y.toFixed(1) > 60 ? "60" : can_manager.vehicle_angle_y.toFixed(1) < -60  ? "-60" : can_manager.vehicle_angle_y.toFixed(1)
                font{
                    family: "Aldrich"
                    pixelSize: 64
                }
            }
        }
    }
}